package digui;

import tools.RandomArray;

import java.util.Arrays;

public class First {
    public static int maxValue(int arr[]){
        return process(arr,0,arr.length - 1);
    }
    public static int process(int arr[], int left, int right){
        if(left == right){
            return arr[left];
        }
        int mid = left + ((right - left) >> 1);
        int leftMax = process(arr,left, mid);
        int rightMax = process(arr, mid + 1, right);
        return Math.max(leftMax, rightMax);

    }

    public static void main(String[] args) {
        int arr[] = RandomArray.generateRandomArray(10, 100);
        for(int num : arr){
            System.out.print(num + " ");
        }
        System.out.println();
        System.out.println(maxValue(arr));
    }
}
